home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Assembly / Mac68k / MANUAL / MAN6.DOC < prev    next >
Encoding:
Text File  |  1985-08-11  |  12.0 KB  |  443 lines  |  [TEXT/Anon]

  1.  
  2.                                                                 MAC.68K
  3.  
  4.  
  5.  
  6.                                 ENDD                                ENDD                                ENDD
  7.  
  8.  
  9.   PURPOSE         To terminate a DUP block.
  10.  
  11.  
  12.   FORMAT               ENDD
  13.              dupname   ENDD
  14.  
  15.  
  16.   DESCRIPTION     A unnamed ENDD will always terminate the current
  17.                DUP or ECHO block even if the block has a dupname. A
  18.                named ENDD terminates the current block if its dupname
  19.                matches the block name. A named ENDD will be ignored
  20.                if its name does not match the active dupname.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.                                 ENDM                                ENDM                                ENDM
  29.  
  30.  
  31.   PURPOSE         To end a macro definition.
  32.  
  33.  
  34.   FORMAT                ENDM
  35.              macroname  ENDM
  36.  
  37.  
  38.   DESCRIPTION     ENDM terminates a macro definition. Accidently
  39.                ommitting an ENDM results in the apparent loss of code
  40.                since the following lines are placed into the macro
  41.                definition and are not assembled.
  42.  
  43.                    A named ENDM does not terminate a macro defintion
  44.                unless the macroname matches the MACRO or MACROL being
  45.                defined. This allows macro definitions to be placed
  46.                inside a macro definition. A macro nested in this
  47.                manner will not be defined until the outer level macro
  48.                is called.
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. MAC.68K                                  -30-
  64. MAC.68K
  65.  
  66.  
  67.                                ENTRY                               ENTRY                               ENTRY
  68.  
  69.  
  70.  
  71.   PURPOSE         To specify relative symbolic entry points for a module
  72.                assembly.
  73.  
  74.  
  75.  
  76.   FORMAT               ENTRY  symbol,symbol,...symbol
  77.  
  78.  
  79.  
  80.   DESCRIPTION     ENTRY is used with MODULE to provide a list of
  81.                symbol names and offset values that are placed in the
  82.                module object file. Any symbol name defined in the
  83.                module may be used. Since modules are assigned an
  84.                origin address of $0, the symbol values represent a
  85.                relative offset from the start ($0) of the module.
  86.  
  87.                    When the object module is later used in another
  88.                assembly, these $0 relative values will be biased by
  89.                the current location address in the calling assembly,
  90.                and the symbol with its new value will be entered into
  91.                the symbol table.
  92.  
  93.  
  94.  
  95.   EXAMPLE              ENTRY   READCH,WRITECH
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.                               -31-                              MAC.68K
  126.                                                                 MAC.68K
  127.  
  128.  
  129.                              EQU  or  =                             EQU  or  =                             EQU  or  =
  130.  
  131.  
  132.  
  133.   PURPOSE         To define a symbol.
  134.  
  135.  
  136.  
  137.   FORMAT     symbol    EQU    expression
  138.              symbol    =      expression
  139.  
  140.  
  141.  
  142.   DESCRIPTION     EQU assigns a permanent value to the symbol name in
  143.                the location field. Any symbols used in the expression
  144.                must have been previously defined.  If an error is
  145.                detected the symbol remains undefined, or retains its
  146.                current value if a redefinition is attempted.
  147.  
  148.                    EQU may not be used on a symbol previously
  149.                established as redefinable with a SET, MAX, MIN, or
  150.                STRCNT. Also any symbol previously established as
  151.                permanent may not be redefined with EQU, SET, MAX,
  152.                MIN, or STRCNT.
  153.  
  154.  
  155.  
  156.   EXAMPLES   RESET     EQU     0
  157.              SAMPLE2   EQU     SAMPLE1+1
  158.              reset     =       0
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187. MAC.68K                                  -32-
  188. MAC.68K
  189.  
  190.  
  191.                                ERRxx                               ERRxx                               ERRxx
  192.  
  193.  
  194.   PURPOSE         To force a source line fatal error flag type P.
  195.  
  196.  
  197.   FORMAT               ERR
  198.                        ERRxx     expression
  199.  
  200.                        xx =   EQ  NE  GE  GT  LE  LT
  201.  
  202.  
  203.   DESCRIPTION     ERRxx can be used to detect and call attention to
  204.                program errors at assembly time. For example, a macro
  205.                expansion might do range checks on parameters and
  206.                force an assembly error if the macro was called with
  207.                an invalid parameter. ERRxx checks are done during
  208.                pass 2 and may contain forward symbol references.
  209.  
  210.                    ERR unconditionally forces a P type source line
  211.                error.
  212.  
  213.                    ERRxx compares the value of the expression in the
  214.                operation field and produces an error if condition xx
  215.                is true. For example, ERREQ produces an error when the
  216.                expression value is zero.
  217.  
  218.  
  219.   EXAMPLES             ERREQ   PAGESIZE
  220.                        ERRGT   P1-5
  221.  
  222.                        IFS     EQ,$P1$$,1     CHECK FOR A NULL PARAMETER
  223.                        ERR                    P1 IS A REQUIRED PARAMETER
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.                                 EVEN                                EVEN                                EVEN
  231.  
  232.  
  233.   PURPOSE         To force the location counter to an even boundary.
  234.  
  235.  
  236.   FORMAT               EVEN
  237.  
  238.  
  239.   DESCRIPTION     If the current location counter is at an odd
  240.                address, EVEN adds one to its value to set it to an
  241.                even address boundary.  Note that all CPU
  242.                instructions, word and long word data operations, and
  243.                section pseudo ops automatically adjust to even word
  244.                boundaries.
  245.  
  246.  
  247.  
  248.  
  249.                               -33-                              MAC.68K
  250.                                                                 MAC.68K
  251.  
  252.  
  253.                                GLOBL                               GLOBL                               GLOBL
  254.  
  255.  
  256.  
  257.   PURPOSE         To declare external symbol names.
  258.  
  259.  
  260.  
  261.   FORMAT               GLOBL  symbol
  262.                        GLOBL  symbol,symbol,...
  263.  
  264.  
  265.  
  266.   DESCRIPTION     GLOBL declares symbols to be external. If the
  267.                symbol is defined in the current assembly, the symbol
  268.                is written to the .O file as a defined external symbol
  269.                and becomes available for use in other routines at
  270.                LO68 link time. If the symbol is undefined in the
  271.                current assembly, it is written to the .O file as an
  272.                undefined external symbol and LO68 searches the other
  273.                load modules to locate the address of the symbol.
  274.  
  275.                    The -U invocation option sets all undefined
  276.                symbols as external references. This is useful for C
  277.                programs which make many references to library
  278.                routines, but it can mask legitimate undefined symbol
  279.                names when used with assembler source files. One can
  280.                use explicit GLOBL statements and avoid the -U
  281.                option.
  282.  
  283.  
  284.  
  285.   EXAMPLE              GLOBL   DUMPMEM,DUMPREG
  286.                        GLOBL   CINCO
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311. MAC.68K                                  -34-
  312. MAC.68K
  313.  
  314.  
  315.                                 HERE                                HERE                                HERE
  316.  
  317.  
  318.  
  319.   PURPOSE         To assemble a block of code saved by previous
  320.                DEFER(s).
  321.  
  322.  
  323.  
  324.   FORMAT               HERE
  325.              defname   HERE
  326.  
  327.  
  328.  
  329.   DESCRIPTION     HERE inserts all source lines saved by prior
  330.                similiarly named DEFERs. A HERE with no source lines
  331.                in its DEFER buffer has no effect on the assembly.
  332.  
  333.  
  334.  
  335.   EXAMPLE
  336.  
  337.      TABLE   MACRO   P1,P2,P3                CHAR   TABLE   'A',1,PROCA
  338.              DC.B    P1                             TABLE   'B',2,PROCB
  339.      T2      DEFER                                  TABLE   'C',3,PROCC
  340.              DC      P2                      VALUE  DS      0
  341.              DEFER                           T2     HERE
  342.      T3      DEFER                           PADDR  DS.L    0
  343.              DC.L    P3                      T3     HERE
  344.              DEFER
  345.              ENDM
  346.                                                     generates
  347.  
  348.                                              CHAR   DC.B    'A'
  349.                                                     DC.B    'B'
  350.                                                     DC.B    'C'
  351.                                              VALUE  DS      0
  352.                                                     DC      1
  353.                                                     DC      2
  354.                                                     DC      3
  355.                                              PADDR  DS.L    0
  356.                                                     DC.L    PROCA
  357.                                                     DC.L    PROCB
  358.                                                     DC.L    PROCC
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.                               -35-                              MAC.68K
  374.                                                                 MAC.68K
  375.  
  376.  
  377.                                IDENT                               IDENT                               IDENT
  378.  
  379.  
  380.  
  381.   PURPOSE         To identify start of program text, program name, and
  382.                program absolute origin.
  383.  
  384.  
  385.  
  386.   FORMAT               IDENT
  387.                        IDENT  name
  388.                        IDENT  name,origin
  389.                        IDENT  name,origin,data,bss
  390.  
  391.  
  392.  
  393.   DESCRIPTION     An IDENT is an optional first card in a MAC.68K
  394.                input source file. If the name field is present, it
  395.                identifies the program name and is used as the base
  396.                file name for the object file. Else the source file
  397.                name is used as the base file name for the object
  398.                file.
  399.  
  400.                    In the Macintosh environment the default (and for
  401.                now the only practical) load address is 0. There is no
  402.                fixed load address for the Mac, and every assembly
  403.                language program should be programmed using relative
  404.                addressing. The only absolute references should be to
  405.                the operating systems fixed location variables and
  406.                constants in low memory ($16A - $B00). The following
  407.                paragraphs describe features available for CPM/68K
  408.                usage.
  409.  
  410.                    MAC.68K uses its own load address as the default
  411.                absolute load origin address for a .68K object file.
  412.                For an absolute load address higher than $500, the
  413.                optional origin field may be used to specify the
  414.                desired address.  Once selected, no code may be
  415.                origined lower than the load address.
  416.  
  417.                    When generating .68K object files, MAC.68K by
  418.                default assigns the data and bss segments to be
  419.                contiguous with the program segment. To specifically
  420.                assign origins to these segments, the data and bss
  421.                fields may be used on the IDENT card.  These two
  422.                fields may contain forward symbol references.
  423.  
  424.  
  425.  
  426.   EXAMPLES             IDENT   CONVERT
  427.                        IDENT   CONVERT,$4000
  428.                        IDENT   TEST,$1000,$4000,$8000
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435. MAC.68K                                  -36- $4000
  436.                        IDENT   TEST,$1000,$4000,$8000
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443. MAC.68K